package com.itcast.elasticsearch.dto;

import lombok.Data;

import java.util.Collections;
import java.util.List;

/**
 * @author sai
 * @version 1.0
 * @date 2021/8/11 0:47
 */
@Data
public class ListDataDTO<T> {
    /**
     * 总条数
     */
    private Long count;
    /**
     * 当前分页返回的数据集合
     */
    private List<T> list;

    public ListDataDTO() {}

    public ListDataDTO(Long count, List<T> list) {
        this.count = count;
        this.list = list;
    }

    public static <T> ListDataDTO<T> empty() {
        return new ListDataDTO<>(0L, Collections.emptyList());
    }
}